<% content_for :head do %>
  <%= javascript_include_tag "user" %>
<% end %>

<% content_for :heading_class, "pb-0" %>

<% content_for :heading do %>
  <h1><%= t ".title" %></h1>
  <%= render :partial => "navigation" %>
<% end %>

<%= render :partial => "layouts/control_icons", :locals => { :icons => %w[zoomin zoomout geolocate] } %>
<%= render :partial => "layouts/markers", :locals => { :types => %w[dot] } %>

<%= bootstrap_form_for current_user, :url => { :action => :update } do |f| %>
  <p id="home_message" class="text-body-secondary m-0<% if current_user.home_location? %> invisible<% end %>"><%= t ".no home location" %></p>
  <div class="row">
    <%= f.text_field :home_lat, :wrapper_class => "col-sm-4 d-flex flex-column", :class => "mt-auto", :id => "home_lat" %>
    <%= f.text_field :home_lon, :wrapper_class => "col-sm-4 d-flex flex-column", :class => "mt-auto", :id => "home_lon" %>
    <div class="col-sm-4 pt-2 align-self-end">
      <button type="button" id="home_show" class="btn btn-outline-primary"<% unless current_user.home_location? %> hidden<% end %> disabled><%= t ".show" %></button>
      <button type="button" id="home_delete" class="btn btn-outline-primary"<% unless current_user.home_location? %> hidden<% end %>><%= t ".delete" %></button>
      <button type="button" id="home_undelete" class="btn btn-outline-primary" hidden><%= t ".undelete" %></button>
    </div>
  </div>
  <%= f.text_field :home_location_name, :wrapper_class => "my-2 col-sm-4 pe-3", :class => "mt-auto", :id => "home_location_name" %>
  <div class="form-check">
    <input class="form-check-input" type="checkbox" name="updatehome" value="1" <% unless current_user.home_location? %> checked <% end %> id="updatehome" />
    <label class="form-check-label" for="updatehome"><%= t ".update home location on click" %></label>
  </div>
  <%= tag.div "", :id => "map", :class => "content_map border border-secondary-subtle rounded z-0" %>

  <%= f.primary t(".save") %>
  <%= link_to t(".cancel"), current_user, :class => "btn btn-link" %>
<% end %>
